<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no,email=no" />
    <title>ECharts</title>
</head>

<body style="margin:0px">
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="main" style="width: 100%;"></div>
    <!-- ECharts单文件引入 -->
    <script type="text/javascript" src="echarts.min.js"></script>
    <script type="text/javascript">
        var mainDom = document.querySelector('#main')
        mainDom.style.height = window.innerHeight + 'px';
        var extend = {}
        function setOption (options) {
            extend = options.extend
            options = JSON.stringify(options)
            var formatOptions = JSON.parse(options, function (k, v) {
                if (v.indexOf && v.indexOf('function') > -1) {
                    return eval('(function(){return ' + v + ' })()')
                }
               return v;
            });
            var myChart = echarts.init(mainDom);
            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(formatOptions);
        }
        function formatTime (d1, format) {
            if (d1 instanceof Date) {
                var date = {
                    'M+': d1.getMonth() + 1,
                    'd+': d1.getDate(),
                    'h+': d1.getHours(),
                    'm+': d1.getMinutes(),
                    's+': d1.getSeconds(),
                    'q+': Math.floor((d1.getMonth() + 3) / 3),
                    'S+': d1.getMilliseconds()
                }
                if (/(y+)/i.test(format)) {
                    format = format.replace(RegExp.$1, (d1.getFullYear() + '').substr(4 - RegExp.$1.length));
                }
                for (var k in date) {
                    if (new RegExp('(' + k + ')').test(format)) {
                        format = format.replace(RegExp.$1, RegExp.$1.length === 1 ? date[k] : ('00' + date[k]).substr(('00' + date[k]).length - RegExp.$1.length))
                    }
                }
                return format
            }
        }
    </script>
</body>

</html>